<template>
  <div class="container">
      <music-item :item="item" v-for="item of mores" :key="item.id"></music-item>
  </div>
</template>

<script>
import HomeHttp from '../../models/HomeHttp'
import MusicItem from '../../components/music/MusicItem.vue'
export default {
  data(){
    return {
      mores:[]
    }
  },
  components:{
    MusicItem
  },
   async activated(){
     var {value} =this.$route.query;
     var  fn = this.handleQuery(value);
     var res = await HomeHttp[fn]();
     var {playlists,albums,result} = res.data;
     if(playlists) {
       this.mores = playlists;
     }else if(albums){
       this.mores = albums
     }else if(result){
       this.mores = result;
     }
   },
   methods:{
     handleQuery(value){
       if(value == "hots"){
         return "getHotMusic"
       }else if(value == "news"){
         return "getNewMusic"
       }else if(value =="djs"){
         return "getDj"
       }
     }
   }
}
</script>

<style>

</style>